// 路由规则
const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    name: 'home',
    component: () => import('@/views/home/home.vue'),
    meta: {
      title: '首页',
      keepAlive: true
    }
  },
  {
    path: '/category',
    name: 'category',
    component: () => import('@/views/category/category.vue'),
    meta: {
      title: '分类',
      keepAlive: true
    }
  },
  {
    path: '/cart',
    name: 'cart',
    component: () => import('@/views/cart/cart.vue'),
    meta: {
      title: '购物车',
      auth: true
    }
  },
  {
    path: '/profile',
    name: 'profile',
    component: () => import('@/views/profile/profile.vue'),
    meta: {
      title: '我的',
      auth: true,
      keepAlive: true
    }
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/profile/login.vue'),
    meta: {
      title: '登录',
      isHiddenTabBar: true
    }
  },
  {
    path: '/register',
    name: 'register',
    component: () => import('@/views/profile/register.vue'),
    meta: {
      title: '注册',
      isHiddenTabBar: true
    }
  },
  {
    path: '/detail/:iid/:id',
    name: 'detail',
    component: () => import('@/views/detail/detail.vue'),
    meta: {
      title: '商品详情',
      isHiddenTabBar: true
    }
  },
  {
    path: '/order',
    name: 'order',
    component: () => import('@/views/order/order.vue'),
    meta: {
      title: '订单列表',
      auth: true,
      isHiddenTabBar: true
    }
  },
  {
    path: '/order-detail/:oid?',
    name: 'order-detail',
    component: () => import('@/views/order/order-detail.vue'),
    meta: {
      title: '订单详情',
      auth: true,
      isHiddenTabBar: true
    }
  },
  {
    path: '/select-address',
    name: 'select-address',
    component: () => import('@/views/order/select-address.vue'),
    meta: {
      title: '选择地址',
      auth: true,
      isHiddenTabBar: true
    }
  }
]

export default routes
